package actions;

import game.constants.ReferenceAction;
import game.constants.ReferenceSpecialFeature;
import interfaces.ActionInterface;
import interfaces.impl.Action;
import objects.SpetialFeature;
import universe.Universe;

public class ActionReciveAttack extends Action{
	
	public ActionReciveAttack(){
		super();
	}
	double damage=0;

	@Override
	public boolean processActionChild(Universe universe) {
		System.out.println("Proceso Action Recive Ataak");
		if(damage==0){return false;}
		for(SpetialFeature feature : target.getListFeatures()){
			if(feature.getId()==ReferenceSpecialFeature.SPETIAL_FEATURE_CURRENT_LIFE){
				feature.setValue(feature.getValue()-damage);
				System.out.println("Proceso Action Recive Ataak1");
				return true;
			}
		}
		System.out.println("Proceso Action Recive Ataak2");
		return false;
	}

	@Override
	public void initializeName() {
		name = "Action Recive Attack";
		
	}

	@Override
	public void initializeId() {
		this.id=ReferenceAction.ACTION_RECIVE_ATTACK;
		
	}

	public double getDamage() {
		return damage;
	}

	public void setDamage(double damage) {
		this.damage = damage;
	}

	@Override
	public void modifyChild(ActionInterface action) {
		if (action instanceof ActionReciveAttack) {
			ActionReciveAttack ac = (ActionReciveAttack) action;
			this.damage=ac.damage;
			
		}
		
	}
	
	@Override
	public ActionReciveAttack cloneAction(){
		ActionReciveAttack action = new ActionReciveAttack();
		action.modifyAction(this);
		return action;
		
	}
	

}
